#include <iostream>
#include <algorithm>
using namespace std;
const int N = 1e6 + 10;
int q[N], n, k;

int main(int argc, char const *argv[])
{
    cin >> n >> k;
    for (int i = 0; i < n; i++)
        cin >> q[i];
    sort(q, q + n - 1);
    for (int i = 0; i < n && i < k - 1; i++)
        if (q[i] == q[i + 1])
            k++;

    return 0;
}
